<?php
class CallAction extends Action {

    public function __construct() {
        parent::__construct();
    }

    public function index() {

    }
    public function validateCode() {
        $vc = new VaildateCode();
        $vc->doimg();
        $_SESSION['code'] = $vc->getCode();
    }
    public function upFile() {
        $this->tpl->display(ROOT_PATH.'/view/admin/public/upFile.html');
    }
    public function upload() {
        if(isset($_POST['send'])) {
            $upload = new UploadFile('pic',$_POST['MAX_FILE_SIZE']);
            $path = $upload->getLinkPath();
            $img = new Image($path);
            $img->thumb(300,300);
            $img->output();
            Tool::alertSetValueClose($path,'上传成功!');
        }
    }
    //ckediter专用上传
    public function ckImg() {
        if(isset($_GET['type'])) {
            $upload = new UploadFile('upload',$_POST['MAX_FILE_SIZE']);
            $ckefn = $_GET['CKEditorFuncNum'];
            $path = $upload->getLinkPath();
            $img = new Image($path);
            $img->ckImg(650,0);
            $img->output();
            echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($ckefn,\"$path\",'');</script>";
        } else {
            exit('警告：由于非法操作导致上传失败！');
        }
    }
}


?>